package com.dylan.channel.v8.channel;

import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;

public abstract class AbstractNioByteChannel extends AbstractNioChannel {


    protected AbstractNioByteChannel(Channel parent, SelectableChannel ch, int readInterestOp) {
        super(parent, ch, readInterestOp);
    }


    @Override
    public final void read() {
        //暂时用最原始简陋的方法处理
        ByteBuffer byteBuf = ByteBuffer.allocate(1024);
        try {
            doReadBytes(byteBuf);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    protected abstract int doReadBytes(ByteBuffer buf) throws Exception;

}
